#include<bits/stdc++.h>
using namespace std;
#define int long long

int a[100005], b[100005];

signed main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		cin >> b[i];
	sort(a + 1, a + n + 1, greater<int>());
	sort(b + 1, b + n + 1, less<int>());
	int sum = 0;
	for (int i = 1; i <= n; i++)
		sum += abs(a[i] - b[i]);
	cout << sum;
	return 0;
}
